package com.hctforgreen.greenservice.utils;

import java.io.FileOutputStream;
import java.text.SimpleDateFormat;

public class DebugUtil {

	public void getUseDate(long lStart) {
		long lEnd = System.currentTimeMillis();

		long lUse = lEnd - lStart;
		java.util.Date date = new java.util.Date();
		SimpleDateFormat format = new SimpleDateFormat("hh-mm-ss");
		date.setTime(lUse);
		String sDate = format.format(date);
	}

	/**
	 * 
	 * @param fileName
	 *            形如："/hct/gree/repair_service/cache/1.txt"
	 * @param jsonString
	 */
	public void writeFile2Sd(String fileName, String jsonString) {

		try {

			FileOutputStream fout = new FileOutputStream(
					HctConstants.DEFAULT_ROOT_PATH + fileName);

			byte[] bytes = jsonString.getBytes();

			fout.write(bytes);

			fout.close();

		}

		catch (Exception e) {

			e.printStackTrace();

		}

	}
}
